package com.example.demo.controller;

import com.example.demo.domain.entity.OrderEntity;
import com.example.demo.domain.entity.StateMachineContextEntity;
import com.example.demo.service.OrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("/order")
public class OrderController {
    private final OrderService orderService;

    @PostMapping
    public OrderEntity create(@RequestBody OrderEntity order) {
        return orderService.create(order);
    }

    @PutMapping("/pay/{id}")
    public OrderEntity pay(@PathVariable("id") Long id) {
        return orderService.pay(id);
    }

    @PutMapping("/deliver/{id}")
    public OrderEntity deliver(@PathVariable("id") Long id) {
        return orderService.deliver(id);
    }

    @PutMapping("/receive/{id}")
    public OrderEntity receive(@PathVariable("id") Long id) {
        return orderService.receive(id);
    }
}
